package view.components;

import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;

public class Toolbar extends JToolBar {
    private final Map<String, JButton> buttons = new HashMap<>();
    
    public Toolbar() {
        setFloatable(false);
    }
    
    public void addButton(String id, String text) {
        JButton button = new JButton(text);
        buttons.put(id, button);
        add(button);
    }
    
    public void addActionListener(String buttonId, java.awt.event.ActionListener listener) {
        JButton button = buttons.get(buttonId);
        if (button != null) {
            button.addActionListener(listener);
        }
    }
}